# -*- coding: UTF-8 -*-
# __author__ = '10459'

from wtforms import Form, StringField, IntegerField
from wtforms.validators import Length, NumberRange, DataRequired, Regexp


#DataRequired()，控制参数必须非空
class SearchForm(Form):
    q = StringField(validators=[DataRequired(),Length(min=1,max=40)])
    page = IntegerField(validators=[NumberRange(min=1,max=100)],default=1)

class DriftForm(Form):
    recipient_name = StringField(validators=[DataRequired(),
                                             Length(min = 2,max=20,
                                                    message='收件人姓名长度必须在2-20个长度之间')])
    mobile = StringField(validators=[DataRequired(),
                                             Regexp('^1[0-9]{10}$',0,"请输入正确的手机号")])
    message=StringField()
    address = StringField(validators=[DataRequired(),
                                             Length(min = 10,max=100,
                                                    message='地址还不到10个字吗？尽量写详细些吧')])